/**
 * Created by Administrator on 2018/11/22.
 */
console.log("hello chrome");

chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
  console.log("###", request, sender, sendResponse);
  postImage(request)
  sendResponse("receive successfully!");
});

function postImage(request) {
  $.ajax({
    type: "POST",
    url: "http://127.0.0.1:8088/images",
    data: JSON.stringify(request),
    dataType: "json",
    contentType: "application/json; charset=utf-8",
    success: function (data) {
      console.log(data)
    },
    error: function (e) {
      console.log(e);
    }
  });
};
